package com.yc.aspects;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

/**
 * @ClassName HelloAspect
 * @since: 2023/8/1 11:44
 * @auth: kirito
 * @description:
 **/
@Component
@Aspect
//@Order(value = 1)
public class ByeAspect implements Ordered {
    @Pointcut("execution(* com.yc.biz.*.findPid(..))")
    private void a() {}

    @Around("a()")
    public Object show(ProceedingJoinPoint joinPoint) {
        System.out.println("ByeAspect在show前面");
        Object obj = null;
        try {
            obj = joinPoint.proceed();
        } catch (Throwable throwable) {
            throwable.printStackTrace();
        }
        System.out.println("ByeAspect在show后面");
        return obj;
    }


    @Override
    public int getOrder() {
        return 1;
    }
}
